package com.longcai.cm.utils;


import com.github.pagehelper.PageInfo;

public class PageInfoUtils<T, V> {
    /**
     * 针对于分页后，又转化成另一个listVo的情景
     * 把分页信息 放到 新的list中
     *
     * @param resultSource 分页的list
     * @param resultTarget 封装vo后新的list
     */
    public void convertPageInfo(PageInfo<T> resultSource, PageInfo<V> resultTarget) {
        resultTarget.setTotal(resultSource.getTotal());
        resultTarget.setPages(resultSource.getPages());
        resultTarget.setPrePage(resultSource.getPrePage());
        resultTarget.setNextPage(resultSource.getNextPage());
        resultTarget.setNavigatepageNums(resultSource.getNavigatepageNums());
        resultTarget.setNavigateFirstPage(resultSource.getNavigateFirstPage());
        resultTarget.setNavigateLastPage(resultSource.getNavigateLastPage());
        resultTarget.setHasPreviousPage(resultSource.isHasPreviousPage());
        resultTarget.setHasNextPage(resultSource.isHasNextPage());
        resultTarget.setIsFirstPage(resultSource.isIsFirstPage());
        resultTarget.setIsLastPage(resultSource.isIsLastPage());
    }
}
